<template>
  <div class="views-gonggao-web-detail" style="margin-top: 20px">
    <div>
      <e-container>
        <div class="hjl-titledianzi">
          <div class="">
<!--            <h2>-->
<!--              <span>详情</span>-->
<!--            </h2>-->
          </div>
          <div class="section_content">
            <div class="news-info">
              <h3 class="title" v-text="map.biaoti"></h3>
              <div class="descount">
                <span class="title"> 添加时间： {{ map.addtime }} </span>

                <e-collect module="shoucang" :form="{biaoid:'xwid',biao:'biao',biaoti:'biaoti'}" :biaoid="$route.query.id" biao="gonggao" :biaoti="map.biaoti">
                  <template #icon="{isCollect}">
                    <i class="fa" :class="isCollect?'fa-star' : 'fa-star-o'"></i>
                  </template>
                  <template #default="{isCollect}"> {{ isCollect ? '取消收藏' : '收藏' }} </template>
                </e-collect>
              </div>
              <div class="content" v-html="map.neirong"></div>
            </div>
          </div>
        </div>
      </e-container>
    </div>
  </div>
</template>

<script setup>
import http from "@/utils/ajax/http";
import DB from "@/utils/db";

import { ref, reactive, watch, computed } from "vue";
import { useRoute } from "vue-router";
import { session } from "@/utils/utils";
import { extend } from "@/utils/extend";
import { useGonggaoFindById, canGonggaoFindById } from "@/module";

const route = useRoute();
const props = defineProps({
  id: {
    type: [Number, String],
  },
  isShowBtn: {
    type: Boolean,
    default: true,
  },
});

/**
 * 获取详情页面的一行数据,当url参数id变更时，当url参数id变更时，自动更新map中的数据
 * @type {EGonggao}
 */
const map = useGonggaoFindById(props.id);
watch(
    () => props.id,
    (id) => {
      canGonggaoFindById(id).then((res) => {
        extend(map, res);
      });
    }
);
// end 获取详情页面的一行数据
</script>

<style scoped lang="scss">
.views-gonggao-web-detail {
}
</style>
